package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.StrategyCatalog;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("destinations")
public class DestinationController {

    @Autowired
    private IDestinationService destinationService;
    @Autowired
    private IRegionService regionService;
    @Autowired
    private IStrategyCatalogService catalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService;

    @GetMapping("/hotRegion")
    public Object queryByHotRegion(){

        return JsonResult.success(regionService.queryHotRegion());
    }

    @GetMapping("/search")
    public Object queryDestByHotRegionId(String regionId){
        return JsonResult.success(destinationService.queryDestByHotRegionId(regionId));
    }

    @GetMapping("/toasts")
    public Object queryToasts(String destId){
        return JsonResult.success(destinationService.queryToasts(destId));
    }

    @GetMapping("/catalogs")
    public Object queryCatalogByDestId(String destId){
        //System.err.println(destinationService.get(id));
        return JsonResult.success(catalogService.queryCatalogByDestId(destId));
    }

    @GetMapping("/strategies/viewnumTop3")
    public Object strategiesViewnumTop3(String destId){

        return JsonResult.success(strategyService.queryStrategiesViewnumTop3(destId));
    }
    @GetMapping("/travels/viewnumTop3")
    public Object travelsViewnumTop3(String destId){

        return JsonResult.success(travelService.queryTravelsViewnumTop3(destId));
    }
    @GetMapping("/list")
    public Object list(){

        return JsonResult.success(destinationService.list());
    }

}
